MongoDB connector

The connector can be used to mask large MongoDB files. The Mongo unload service splits the large collections into smaller chunks and passes them onto the masking service. After the masking is completed, the files are sent to the Mongo load service, which imports the masked files into the target collection.

Supported versions

Platforms Version

Linux

MongoDB 4.4.x

MongoDB 5.0.x

MongoDB 6.0.x

MongoDB 7.0.x

MongoDB 8.0.x

Roles and privileges

MongoDB users should have the following roles and privileges:

Topology of Database  Source Database User Privileges  Target Database User
Privileges 
 

Default 

drop_collection : No 

Default 

drop_collection : No 

Sharded Replica Set 

role: clusterMonitor  

db: admin 

role: read  

db: <source database> 

 role: clusterAdmin  

db: admin”  

role: readWrite  

db: target database 

 role: read  

db: <source database> 

 role: readWrite  

db: <target database> 

Non Sharded Replica Set 

 role: clusterMonitor  

db: admin 

role: read  

db: <source database> 

 role: clusterMonitor  

db: admin  

role: readWrite  

db: <target database>  

 role: read,  

db: <source database> 

 role: readWrite  

db: <target database>  

Prerequisites

  1. Mongo Unload and Mongo Load service image names are to be used under unload-service and load-service. The NFS location has to be mounted onto the Docker containers for unload and load services. Example for mounting /mnt/hyperscale.

    Copy
    # As an example docker-compose.yaml
    unload-service:
         image: delphix-mongo-unload-service-app:${VERSION}
    volumes:
       # Uncomment below lines to mount respective paths.
       - /mnt/hyperscale:/etc/hyperscale

    load-service:
         image: delphix-mongo-load-service-app:${VERSION}
    volumes:
       # Uncomment below lines to mount respective paths.
       - /mnt/hyperscale:/etc/hyperscale

     

  2. Uncomment the below lines from docker-compose.yaml file under controller > environment:

Copy
# uncomment below for MongoDB connector
#- SOURCE_KEY_FIELD_NAMES=database_name,collection_name    
#- VALIDATE_UNLOAD_ROW_COUNT_FOR_STATUS=${VALIDATE_UNLOAD_ROW_COUNT_FOR_STATUS:-false}
#- VALIDATE_MASKED_ROW_COUNT_FOR_STATUS=${VALIDATE_MASKED_ROW_COUNT_FOR_STATUS:-false}
#- VALIDATE_LOAD_ROW_COUNT_FOR_STATUS=${VALIDATE_LOAD_ROW_COUNT_FOR_STATUS:-false}
#- DISPLAY_BYTES_INFO_IN_STATUS=${DISPLAY_BYTES_INFO_IN_STATUS:-true}
#- DISPLAY_ROW_COUNT_IN_STATUS=${DISPLAY_ROW_COUNT_IN_STATUS:-false}

 

  1. Set the value of LOAD_SERVICE_REQUIRE_POST_LOAD=false inside the “.env”file.

    Copy
    # Set LOAD_SERVICE_REQUIRE_POST_LOAD=false for MongoDB Connector
    LOAD_SERVICE_REQUIRE_POST_LOAD=false

     

  2. Uncomment the below lines from “.env” file.

    Copy
    # Uncomment below for MongoDB Connector
    #VALIDATE_UNLOAD_ROW_COUNT_FOR_STATUS=false
    #VALIDATE_MASKED_ROW_COUNT_FOR_STATUS=false
    #VALIDATE_LOAD_ROW_COUNT_FOR_STATUS=false
    #DISPLAY_BYTES_INFO_IN_STATUS=true
    #DISPLAY_ROW_COUNT_IN_STATUS=false

     

  3. To leverage Reduced Privilege Operations, you must set the drop_collectionpropertyto No. After this property is set, the connector will no longer require clusterAdmin and clusterMonitor privileges. The following are the implications of setting drop_collectionproperty to No:

    • The connector will not validate clusterMonitor privilege at the source and clusterMonitorandclusterAdmin privileges at the target. For more information, refer to the Roles and Privileges table above.

    • The connector will skip the following operations on a target collection:

      1. shard collection

      2. create shard key

      3. create index

You will be responsible for executing the above operations on a target collection.

Property values

Mandatory changes are required for the MongoDB Connector in the docker-compose.yaml and .env files:

Property

Value

SOURCE_KEY_FIELD_NAMES

database_name,collection_name

LOAD_SERVICE_REQUIRE_POST_LOAD

false

VALIDATE_UNLOAD_ROW_COUNT_FOR_STATUS

false

VALIDATE_MASKED_ROW_COUNT_FOR_STATUS

false

VALIDATE_LOAD_ROW_COUNT_FOR_STATUS

false

DISPLAY_BYTES_INFO_IN_STATUS

true

DISPLAY_ROW_COUNT_IN_STATUS

false

For default values, see Configuration settings.

Known limitation:

  • In-Place Masking is not supported.